// 加载配置文件列表
var configJSON = 'config/config.json';
$.getJSON(configJSON, function (data) {
    var code = getArgs('code');
    if(code == null || code.length < 1){
        alert("未找到该页面");
        window.history.back(-1);
    }
    var htmldata = '';
    var htmltitle = '';
    $.each(data,function (i, item) {
        if(item.code == code) {
            htmltitle = item.name;
            if(item.data.length > 0) {
                $.each(item.data, function (j, row) {
                    htmldata += '<a href="list-details.html?dir=' + row.name + '&code=' + code + '" class="collection-item avatar waves-effect waves-light">'
                        + '<i class="material-icons circle orange">folder</i>'
                        + '<span class="title">' + row.desc + '</span>'
                        + '</a> '
                })
            }
            else {
                htmldata += '<a href="#" class="collection-item avatar waves-effect waves-light red-text"><span class="title">当前目录暂无文件</span></a>'
            }
            return false
        }
    })
    if(htmltitle == '') {
        alert("未找到该分类文档");
        window.history.back(-1);
    }
    $("#card-action").html('<b>' + htmltitle +'</b>');
    $("#collection").html(htmldata);
})
